package com.user.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.itcast.user.domain.User;
import com.itcast.user.utils.C3P0Utils;

public class UserDao {

	/**
	 * 查找满足条件的寿星
	 * 
	 * @return users
	 */
	public List<User> findUserByBirthday() {
		List<User> users = null;
		try {
			QueryRunner queryRunner = new QueryRunner(C3P0Utils.getDataSource());
			String sql = "select * from user where birthday like '%-02-22'";
			users = queryRunner.query(sql, new BeanListHandler<>(User.class));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return users;
	}

}
